package com.cosina.game.crystallight.model.crystal;

import com.cosina.game.crystallight.MediaPlayerAdapter;

public class Cuvette extends CrystalContainer {

	public void detect() {
		if (null == Palm.getContainer()) {
			if (this.crystal != null) {
				Palm.setContainer(this);
			}
		} else {
			if(Palm.getContainer() == this){
				Palm.setContainer(null);
				return ;
			}
			
			CrystalContainer palmContainer = Palm.getContainer();
			Crystal plamStuff = palmContainer.crystal;
			if (isEmpty()) {
				MediaPlayerAdapter.dropCrystal();
				this.crystal = plamStuff;
				palmContainer.crystal = null;
				Palm.setContainer(null);
			} else {
				if(this.crystal.color == plamStuff.color){
					MediaPlayerAdapter.mixture();
					this.crystal.doMixture((Crystal) plamStuff);
					palmContainer.crystal = null;
					Palm.setContainer(null);
				}
			}
		}
	}
}
